<template>
	<base-page>
		<view slot="header">
			<!-- #ifdef MP-WEIXIN -->
			<cu-custom :isBack="true" bgColor="bg-white">
				<block slot="content">钱包</block>
			</cu-custom>
			<!-- #endif -->
			<!-- #ifdef H5 -->
			<block>
				<cu-custom :isBack="true" bgColor="bg-white">
					<block slot="content">钱包</block>
				</cu-custom>
			</block>
			<!-- #endif -->
		</view>
		<view slot="center" class="auto-100 ">
			
			<view class="section">
				<view class="logo">
					<image src="https://toc.nanyuecloud.com/toc-inst-app/zqanswer/test/img/xmg/wallet/wallet.png">
				</view>
				<view class="txt df-cen">
					<text>￥</text>
					<view>{{moneyWithdraw}}</view>
				</view>
				<view class="btn bg-gradual-orange round" @click="charge">充值</view>
				<view class="btn btn2  round" @click="toWithDraw">提现</view>
				<view class="yemx" @click="gotoInwithdrawDetail">余额明细</view>
			</view>
			
			
		</view>
	</base-page>
</template>

<script>
	import {
		memberWithdraw
	} from '@/common/js/request/modules/public.js'
	import {
		mapGetters,
		mapMutations
	} from 'vuex';
	export default {
		data() {
			return {
				moneyWithdraw: 0
			};
		},
		computed: {
			// #ifdef H5
			...mapGetters(['env'])
			// #endif
		},
		onLoad(e) {},
		onShow(e) {},
		methods: {
			gotoInwithdrawDetail(){
				this.$Router.push({
					path:'/publicPages/wallet/withdrawDetail'
				})
			},
			getWithdrawInfo() {
				memberWithdraw().then(res => {
					this.moneyWithdraw = res.member_info.balance_money
					// console.log(res, this.moneyWithdraw);
				})
			},
			toWithDraw() {
				// #ifdef MP-WEIXIN
					this.$Utils.tip('~请打开醒目购App进行提现~')
					return
				// #endif
				// this.$Utils.tip('~活动结束后，开放提现功能~')
				// return
				// #ifdef H5
				// console.log("this.env",this.env)
				if(this.isNativeApp()){
					// if(this.env[0]=='iOS'){
					// 	this.$Utils.tip('~提现功能暂未开放~')
					// 	return
					// }
					this.$Router.push({
						path: '/publicPages/wallet/withdraw'
					})
				}else{
					this.$Utils.tip('~请打开醒目购App进行提现~')
					return
				}
				// #endif

			},
			charge() {
				this.$Router.push({
					path: '/publicPages/wallet/combo'
				})
			}
		},
		mounted() {
			this.getWithdrawInfo()
		}
	};
</script>

<style lang="scss">
	.section {
		text-align: center;
		position: relative;
		image {
			width: 100%;
			height: 100%;
		}

		.logo {
			margin: 50px auto 10px;
			width: 120px;
			height: 120px;
		}

		.txt {
			margin-bottom: 50px;
			font-size: 16px;
			font-weight: bold;
			color: #222222;
			align-items: baseline;

			>view {
				font-size: 40px;
				font-family: DIN;
				font-weight: bold;
				color: #222222;
			}
		}

		.btn {
			margin: 15px auto;
			width: 70%;
			padding: 10px 0;
			text-align: center;
			font-size: 16px;
		}

		.btn2 {
			background: #ffecee;
			color: #fd3e5a;
		}
	}
	.yemx{
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #999999;
		position: absolute;
		top: 180%;
		left: 50%;
		transform: translate(-50%,-50%);
	}
</style>
